import { getAllCategoryListApi } from '@/services/category';
import { useEffect, useState } from 'react';

export default () => {
  const [allCategoryList, setAllCategoryList] = useState<any[]>([]);

  const getList = async () => {
    const { rsCode, body } = await getAllCategoryListApi();
    if (rsCode === '00000000' && Array.isArray(body)) {
      setAllCategoryList(body);
    }
  };

  useEffect(() => {
    getList();
  }, []);

  return {
    allCategoryList,
  };
};
